<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org/">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>登陆页</title>
		<!-- 设置360浏览器渲染引擎 -->
		<meta name="renderer" content="webkit">
		<style>
			.errorMsg{
				color: #f0ede9;
				font-weight: normal;
				font-size:18px;
				background-color:red;
				display: none;
				text-align: center;
			}
		</style>
		<link rel="icon" type="image/png" th:href="@{/user/img/favicon.png}">
		<link rel="stylesheet" type="text/css" th:href="@{/user/amazeui/css/amazeui.css}" />
		<script type="text/javascript" charset="utf-8" th:src="@{/user/js/jquery.js}"></script>
		<script type="text/javascript" charset="utf-8" th:src="@{/user/amazeui/js/amazeui.js}"></script>
		<!-- 全局CSS -->
		<link rel="stylesheet" th:href="@{/user/css/base.css}">
		<!-- 当前页面 css -->
		<link rel="stylesheet" type="text/css" th:href="@{/user/css/login.css}"/>
		<!-- 当前页面功能 js -->
		<script th:src="@{/user/js/pages/login.js}"></script>
		<script>
			function getParams(){
				//url问号后面的字符串
				var url = location.search;
				var obj=null;
				if(url.indexOf("?")!=-1){
					obj = new Object();
					var str = url.substr(1);
					var strs = str.split("&");
					for(var i=0;i<strs.length;i++){
						var s  = strs[i].split("=");
						obj[s[0]]=decodeURIComponent(s[1]);
					}

					return obj;
				}
			}


			$(function (){
				$("#login").click(function (){
					$.ajax({
						url:"/user/userserver/login",
						dataType:"json",
						data:{
							"phone":$("#doc-ipt-3").val(),
							"password":$("#doc-ipt-pwd-2").val()
						},
						type:"post",
						success:function (result) {
							if (result.status === 2001){
								location.href = "http://localhost:9005/book/showindex";
							}else {
								$(".errorMsg").text(result.msg);
								$(".errorMsg").show("fast");
								setTimeout(function () {
									$(".errorMsg").hide("normal");
								},3000)
							}
						}
					})
				})

			});
		</script>
	</head>
	<body>
		<!-- nav-start -->
		<header>
			<div class="base-nav">
				<ul class="am-g am-g-fixed">
					<li class="am-u-sm-6">
						<img class="nav-img" src="./img/logo.png">
					</li>
					<li class="am-u-sm-2">
					    <div>√</div>
						<span>正版好图书</span>
					</li>
					<li class="am-u-sm-2">
					    <div>邮</div>	
						<span>全场满69包邮</span>
					</li>
					<li class="am-u-sm-2">
					    <div>折</div>
						<span>特价书一折起</span>
					</li>
				</ul>
			</div>
			
		</header>
		<!-- nav-end -->

		<!-- login-start -->
		<div class="am-g am-g-fixed login-body">
			<div class="login-title">
				<h2>用户登陆</h2>
			</div>
			<div class="login-content">
				<form class="am-form am-form-horizontal">
					<div class="am-form-group">
					    <label for="doc-ipt-3" class="am-u-sm-2 am-form-label">用户名:</label>
					    <div class="am-u-sm-6  am-u-end">
					        <input type="text" id="doc-ipt-3" placeholder="用户名/邮箱/已验证手机">
					    </div>
					</div>

					<div class="am-form-group">
					    <label for="doc-ipt-pwd-2" class="am-u-sm-2 am-form-label">密码:</label>
					    <div class="am-u-sm-6  am-u-end">
					        <input type="password" id="doc-ipt-pwd-2" placeholder="密码">
					    </div>
					</div>

					<div class="am-form-group">
					    <label for="doc-ipt-code-2" class="am-u-sm-2 am-form-label">验证码:</label>
					    <div class="am-u-sm-3  am-u-end">
					        <input type="password" id="doc-ipt-code-2" placeholder="图片验证码" disabled>
					        <p class="code"></p>
					        <p class="change"><a href="javascript:void(0)" onclick="change()" >换一换</a></p>
					    </div>
					</div>

					<div  class="am-form-group">
						<div class="am-u-sm-6  am-u-end">
						 	<input type="button" id="login" class="am-btn am-btn-block" value="登录"/>
						</div>
						
					</div>

				</form>
			</div>
			<div  class="am-u-sm-6 forget am-u-sm-offset-2">
				<span><a href="#">忘记密码?</a></span>
				<span><a href="#">新用户注册&gt;&gt;</a></span>
			</div>

			<div>
				<span class="errorMsg am-u-sm-2" align="center" ></span>
			</div>
			 
		</div>
		<!-- login-end -->
		<!-- foot start -->	
		<div class="base-shop-foot">
			<p>© 2018 南京网博优壹 by 项目组-chw <br>2018年03月21日23:20:50</p>
		</div>
		<!-- foot end -->
	</body>
</html>